import { validatePhoneTwo } from '@/utils/validate'
/* 是否金额 2位小数点*/
export const isMoneyTwo = (rule, value, callback) => {
  const reg = /^(0|[1-9]\d*)(\.\d{1,2})?$/
  if (value == '' || value == undefined || value == null) {
    callback()
  } else {
    if (!reg.test(value)) {
      callback(new Error('请输入合法的金额数字，最多两位小数'))
    } else {
      callback()
    }
  }
}
/* 是否金额 8位小数点 非必定*/
export const isMoneyEightNot = (rule, value, callback) => {
  const reg = /^(0|[1-9]\d*)(\.\d{1,8})?$/
  if (value == '' || value == undefined || value == null) {
    callback()
  } else {
    if (!reg.test(value)) {
      callback(new Error('请输入合法的金额数字，最多八位小数'))
    } else {
      callback()
    }
  }
}
/* 是否金额 8位小数点 -必填*/
export const isMoneyEight = (rule, value, callback) => {
  const reg = /^(0|[1-9]\d*)(\.\d{1,8})?$/
  if (!reg.test(value)) {
    callback(new Error('请输入合法的金额数字，最多八位小数'))
  } else {
    callback()
  }
}
// 新增商机表单规则
export const formRules = {
  title: [{ required: true, message: '任务标题不能为空', trigger: 'blur' }],
  businessType: [
    { required: true, message: '任务类型不能为空', trigger: 'blur' }
  ],
  impSign: [{ required: true, message: '任务级别不能为空', trigger: 'blur' }],
  remark: [
    { required: true, message: '任务描述不能为空', trigger: ['blur', 'change'] }
  ],
  // startTime: [
  //   { required: true, message: '开始时间不能为空', trigger: 'blur' }
  // ],
  // endTime: [{ required: true, message: '结束时间不能为空', trigger: 'blur' }],
  // businessName: [
  //   { required: true, message: '项目名称不能为空', trigger: 'blur' }
  // ],

  directorId: [
    { required: true, message: '负责人员不能为空', trigger: 'blur' }
  ],

  severity: [{ required: true, message: '严重程度不能为空', trigger: 'blur' }],
  questionType: [
    { required: true, message: '问题分类不能为空', trigger: 'blur' }
  ],
  reach: [{ required: true, message: '影响范围不能为空', trigger: 'blur' }],
  customerId: [
    { required: true, message: '客户名称不能为空', trigger: 'blur' }
  ],
  contactTel: [
    { required: true, message: '联系人/电话不能为空', trigger: 'blur' }
  ],
  goAddr: [{ required: true, message: '上门地址不能为空', trigger: 'blur' }],
  cusAddr: [{ required: true, message: '客户地址不能为空', trigger: 'blur' }],
  visitTime: [
    { required: true, message: '预计上门时间不能为空', trigger: 'blur' }
  ]
}
